using System.Collections.Generic;
using Newtonsoft.Json;

namespace Betfair.Api
{
    public sealed class Filter
    {
        [JsonProperty("eventIds", NullValueHandling = NullValueHandling.Ignore)]
        public HashSet<int> EventIds { get; private set; }

        [JsonProperty("eventTypeIds", NullValueHandling = NullValueHandling.Ignore)]
        public HashSet<int> EventTypeIds { get; private set; }

        [JsonProperty("inPlayOnly", NullValueHandling = NullValueHandling.Ignore)]
        public bool? InPlayOnly { get; private set; }

        public Filter SetEventId(int eventId)
        {
            if (EventIds == null)
                EventIds = new HashSet<int>();
            EventIds.Add(eventId);
            return this;
        }

        public Filter SetEventTypeId(int eventTypeId)
        {
            if (EventTypeIds == null)
                EventTypeIds = new HashSet<int>();
            EventTypeIds.Add(eventTypeId);
            return this;
        }

        public Filter SetInPlayOnly(bool inPlayOnly)
        {
            InPlayOnly = inPlayOnly;
            return this;
        }
    }
}